FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 4114
EXPOSE 44399

FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY lottery.api/lottery.api.csproj lottery.api/
RUN dotnet restore lottery.api/lottery.api.csproj
COPY . .
WORKDIR /src/lottery.api
RUN dotnet build lottery.api.csproj -c Release -o /app

FROM build AS publish
RUN dotnet publish lottery.api.csproj -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "lottery.api.dll"]
